home *** CD-ROM | disk | FTP | other *** search
/ Pascal Super Library / Pascal Super Library (CW International)(1997).bin / STRINGS / TPSTR7 / EXAM16.PAS < prev    next >
Pascal/Delphi Source File  |  1993-03-11  |  3KB  |  63 lines

  1. Program Exam16;
  2.  
  3. {**************************************************************************}
  4. {                                                                          }
  5. { Ce programme démontre les possibilités de ChrQtyx.                       }
  6. {                                                                          }
  7. {**************************************************************************}
  8.  
  9. Uses
  10.   TpStr;
  11.  
  12. Var
  13.   S1 : String;
  14.   I  : Integer;
  15.  
  16. {  ---------------------------------------------------------------         }
  17. {  Function    ChrQty(Str: String;Match: Char): Integer;                   }
  18. {  ---------------------------------------------------------------         }
  19. {                                                                          }
  20. {  Effet     : Retourne la quantité de caractères correspondant à <Match>  }
  21. {              trouvés dans <Str> ou 0 si <Match> n'est pas rencontré.     }
  22. {                                                                          }
  23. {  Usage     : Chaîne pascal.                                              }
  24. {                                                                          }
  25. {  Vitesse   : 7800/s                                                      }
  26. {                                                                          }
  27. { -------------------------------------------------------------------------}
  28.  
  29. Procedure Test1;
  30. Begin
  31.   S1 := 'abacadaeafagahaiajakalamanaoapaqarasatauavawaxayaz';
  32.   I := ChrQty(S1,'a');
  33.   S1 := '3.14116';
  34.   I := ChrQty(S1,'0');
  35. end;
  36.  
  37. {  ---------------------------------------------------------------         }
  38. {  Function    ChrQtyI(Str: String;Match: Char):Integer;                   }
  39. {  ---------------------------------------------------------------         }
  40. {                                                                          }
  41. {  Effet     : Identique à ChrPosR, mais sans tenir compte des             }
  42. {              majuscules/minuscules.                                      }
  43. {                                                                          }
  44. {  Usage     : Idem.                                                       }
  45. {                                                                          }
  46. {  Vitesse   : 7800/s                                                      }
  47. {                                                                          }
  48. { -------------------------------------------------------------------------}
  49.  
  50. Procedure Test2;
  51. Begin
  52.   S1 := 'abacadaeafagahaiajakalamanaoapaqarasatauavawaxayaz';
  53.   I := ChrQtyI(S1,'A');
  54.   I := ChrQtyI(S1,'1');
  55. end;
  56.  
  57. Begin
  58.   Test1;
  59.   Test2;
  60. End.
  61.  
  62. { -------------------------------------------------------------------------}
  63.